package com.nchu.controller;

import com.nchu.pojo.User;
import com.nchu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//哈哈哈哈哈哈哈哈哈
/**
 * @ClassName UserController
 * @Description TODO
 * @Author FJQ
 * @Date 2023/7/7 11:34
 * @Version 1.0
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 查询所有
     * @return
     */
    @RequestMapping("/uu")
    public List<User> list(){
        List<User> list = userService.list();
        list.stream().forEach(System.out::println);
        return list;
    }

    @RequestMapping("/us/{id}")
    public User userById(@PathVariable Integer id){
        User user = userService.getById(id);
        return user;
    }


}
